<template>
  <el-form :model="formData" label-width="auto" style="max-width: 600px">
    <el-form-item label="店铺名称">
      <el-input v-model="formData.name" placeholder="请输入店铺名称"/>
    </el-form-item>
    <el-form-item label="店铺类型">
      <el-input v-model="formData.storeType" placeholder="请输入店铺类型" />
    </el-form-item>
    <el-form-item label="起送费">
      <el-input v-model="formData.price1" placeholder="请输入起送费" />
    </el-form-item>
    <el-form-item label="配送费">
      <el-input v-model="formData.price2" placeholder="请输入配送费"  />
    </el-form-item>
    <el-form-item>
      <el-button align="center" type="primary" @click="onSubmit">提交</el-button>
      <el-button align="center" @click="cancel">取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { defineEmits,defineProps,ref } from "vue";
import requestUtil from "@/api/request.js";
import { ElMessage } from "element-plus";
let formData = ref({
  name: '',
  storeType: '',
  price1: '',
  price2: ''
});

const emits = defineEmits(["cancel", "submit"]);
const cancel = () => {
  emits("cancel");
};
const onSubmit = async () => {
  let res = await requestUtil.post("management/updateStoreInfo/",formData.value);
  if (res.data.code === 200) {
    ElMessage.success("添加成功");
    emits("submit");
  }
  
};
</script>